package cn.fenqing.demo.demo.controller;

import cn.fenqing.demo.demo.service.AccountService;
import cn.fenqing.demo.demo.service.IUserService;
import cn.fenqing.demo.demo.service.impl.UserServiceImpl;
import cn.fenqing.demo.demo.service.impl.UserServiceImpl2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fenqing
 * @version 0.0.1
 * @date 2021/7/7 11:03
 * @description
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserServiceImpl userService;
    @Autowired
    private UserServiceImpl2 userServiceImpl2;

    @Autowired
    private AccountService accountService;

    @PostMapping("/save")
    public String save(String username, String password){
        userService.save(username, password);
        userServiceImpl2.save(username, password);
        return "ok";
    }

    @PostMapping("/save2")
    public String save2(String username, String password){
        userServiceImpl2.save2(username, password);
        return "ok";
    }

    @PostMapping("/save3")
    public String save3(String username){
        accountService.save(username);
        return "ok";
    }

}
